package com.wentao.thisFacade.business;

import com.wentao.thisCommon.model.RequestBase;
import com.wentao.thisCommon.model.ResultBase;
import com.wentao.thisFacade.common.UserInfo;
import com.wentao.thisFacade.domain.reqeust.*;
import com.wentao.thisFacade.domain.result.LoginUserResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping(value = "/authority")
public interface AuthorityCtrInterface {

    /**
     * 账号密码登录
     *
     * @param entity 手机号+密码
     * @return 登录结果
     */
    @PostMapping(value = "/Login")
    ResultBase<UserInfo> login(@RequestBody RequestBase<LoginRequest> entity);

    /**
     * 手机号获取验证码
     *
     * @param entity 手机号码+验证码类型
     * @return 获取验证码结果
     */
    @PostMapping("/MobileCodeGain")
    ResultBase<Boolean> mobileCodeGain(@RequestBody RequestBase<MobileCodeRequest> entity);

    /**
     * 手机号+验证码登录
     *
     * @param entity 手机号码+验证码
     * @return 登录结果
     */
    @PostMapping("/MobileAndCodeLogin")
    ResultBase<UserInfo> mobileAndCodeLogin(@RequestBody RequestBase<MobileAndCodeRequest> entity);

    /**
     * 根据userId和token登录
     *
     * @param entity userId和token
     * @return 登录结果
     */
    @PostMapping(value = "/LoginByUserNameAndToken")
    ResultBase<UserInfo> loginByUserNameAndToken(@RequestBody RequestBase<UserInfo> entity);

    /**
     * 修改密码--通过验证码修改
     *
     * @param entity 手机号+验证码+新密码
     * @return 操作结果
     */
    @PostMapping(value = "/ChangePassword")
    ResultBase<Boolean> changePassword(@RequestBody RequestBase<ForgetPasswordRequest> entity);

    /**
     * 退出登录
     *
     * @param entity 用户名=注册手机号
     * @return 退出结果
     */
    @PostMapping(value = "/LoginOut")
    ResultBase<Boolean> loginOut(@RequestBody RequestBase<LoginRequest> entity);

}
